In video coding in recent years, as represented by ITU-T Rec. H.264|ISO/IEC14496-10 Advanced Video Coding (H.264/MPEG-4 AVC, referred to as “H.264” hereinafter), which is one standard of a video data compression coding scheme recommended by the International Telecommunication Union (ITU) and which is recommended by the International Organization for Standardization (ISO) as part of MPEG-4 (ISO/IEC 14496, MPEG-4 Part 10 Advanced Video Coding), a technique of performing a filter process named in-loop filtering on decoded images is applied so as to enhance the image quality. In H.264, a filter process named de-blocking filtering is employed so as to reduce block distortion.
In High Efficiency Video Coding (HEVC), which is one of the latest video coding schemes yielding a compression ratio higher than that of H.264, a Sample Adaptive Offset (SAO) process is performed after the filter process using a de-blocking filter in order to make boundaries between blocks less noticeable. In the SAO process, a correction is performed on a decoded image to which a de-blocking filter process has applied so that the decoded image becomes closer to the original image and the signal-to-noise ratio (S/N ratio) is improved.
The SAO process performs a correction process, in accordance with the shape of an edge, on a decoded image obtained by a filter process performed by a de-block filter. In the SAO process, Pixel of images are categorized into groups in accordance with edge shapes around each pixel, a correction value is obtained so that the square error of decoded images is minimized, and correction values are added for pixels of each group. In this process, it is ruled that correction values have a fixed correction direction and corrections are only made in the direction by which edges are bent.
There is a problem in which because it is ruled to perform correction only in the direction of bending of edges in the SAO process in an encoder, square errors can be reduced between an original image and a decoded image by employing a correction value calculation method in the SAO process while edges are smoothed so as to sometimes cause blurring depending upon distribution of coding errors around edges.    Non-Patent Document 1: ISO/IEC 14496-10 (MPEG-4 Part 10)/ITU-T Rec.H.264    Non-Patent Document 2: Thomas Wiegand, Woo-Jin Han, Benjamin Bross, Jens-Rainer Ohm, Gary J. Sullivan, “Working Draft 8 of High-Efficiency Video Coding” JCTVC-J1003, 2012-07 Stockholm